<!-- 导航URL -->
<div class="row wrapper border-bottom white-bg page-heading">
	<div class="col-md-12">
		<ol class="breadcrumb">
			<li><a>主页</a></li>
			<li><a>用户中心</a></li>
			<li class="active"><strong>角色管理</strong></li>
		</ol>
	</div>
</div>
<!-- 主要内容 -->
<div class="wrapper wrapper-content animated fadeIn" ng-app
	ng-controller="roleCtrl">
	<form class="form-horizontal" id="form1">
		<div class="row">
			<div class="col-lg-12">
				<div class="panel-body ibox float-e-margins">
					<div class="ibox-title">
						<h5>角色条件查询</h5>
						<div ibox-tools></div>
					</div>
					<div class="ibox-content">
						<div class="form-group">
							<label class="col-sm-2 control-label">角色名称：</label>
							<div class="col-sm-2">
								<input type="text" class="form-control"
									ng-model='baseInfo.roleName'>
							</div>
							<label class="col-sm-2 control-label">角色状态：</label>
							<div class="col-sm-2">
								<select class="form-control" ng-model='baseInfo.roleStatus'
									ng-options="x.value as x.text for x in statusAll">
								</select>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2"></label>
							<div class="col-sm-8">
								<button class="btn btn-primary6 btn-mr20" type="button" ng-click='query()'>查询</button>
								<button class="btn btn-primary3 btn-mr20" type="button" ng-click="resetForm()">清空</button>
								<button class="btn btn-primary5" type="button" ng-click="addRoleModal()">新增</button>
							</div>
						</div>
					</div>
				</div>

				<div class="panel-body ibox float-e-margins">
					<div class="ibox-title">
						<h5>用户信息列表</h5>
						<div ibox-tools="" class="ng-scope"></div>
					</div>
					<div class="ibox-content">
						<div class="gridStyle" ui-grid="roleGrid" ui-grid-pagination ui-grid-resize-columns></div>
					</div>
				</div>
				<div style="height: 50px"></div>
			</div>
		</div>
	</form>
	
	<form class="form-horizontal" id="form2" name="horizontal" novalidate>
		<!-- add role -->
		<div id="addRoleModal" class="modal fade" tabindex="-1" role="dialog">
			<div class="modal-dialog" style="width: 900px">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">
							&times;</button>
						<h3 class="modal-title">新增角色</h3>
					</div>
					<div class="modal-body">
						<div class="form-group">
							<label class="col-sm-2 control-label"><i class="red_req">*</i>角色名称：</label>
							<div class="col-sm-3">
								<input type="text" class="form-control"
									ng-model='newRoleInfo.roleName' name="roleName" required/>
								<div class="req_mesg" ng-show="horizontal.roleName.$dirty && horizontal.roleName.$invalid">
									<span ng-show="horizontal.roleName.$error.required">角色名称不能为空</span>
								</div>
							</div>
							<label class="col-sm-2 control-label"><i class="red_req">*</i>角色编码：</label>
							<div class="col-sm-3">
								<input type="text" class="form-control"
									ng-model='newRoleInfo.roleCode' name="roleCode" required>
								<div class="req_mesg" ng-show="horizontal.roleCode.$dirty && horizontal.roleCode.$invalid">
									<span ng-show="horizontal.roleCode.$error.required">角色编码不能为空</span>
								</div>
								<span class="req_mesg" ng-hide="codeCheckFlag">
									{{codeCheckMsg}}
								</span>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">备注：</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" ng-model='newRoleInfo.roleRemark'>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">状态：</label>
							<div class="col-sm-3">
								<switch class="switch" ng-model="newRoleInfo.roleStatus" ng-true-value="1" ng-false-value="0"/>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label"></label>
							<div class="col-sm-6">
								<button class="btn btn-primary btn-mr20" type="button" ng-click='submitNewRole()'
									id="btnSubmit" ng-disabled="horizontal.$invalid || submitting">提交</button>
									<button class="btn btn-primary8" type="button" ng-click='cancel()'
									>取消</button>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</form>
		<!-- add role -->
		<!-- edit role -->
	<form class="form-horizontal" id="form2" name="horizontalEdit" novalidate>
		<div id="editRoleModal" class="modal fade" role="dialog">
			<div class="modal-dialog" style="width: 900px">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">
							&times;</button>
						<h3 class="modal-title">修改角色</h3>
					</div>
					<div class="modal-body">
						<div class="form-group">
							<label class="col-sm-2 control-label"><i class="red_req">*</i>角色名称：</label>
							<div class="col-sm-3">
								<input type="text" class="form-control"
									ng-model='roleInfo.roleName' name="roleName" required/>
								<div class="req_mesg" ng-show="horizontalEdit.roleName.$dirty && horizontalEdit.roleName.$invalid">
									<span ng-show="horizontalEdit.roleName.$error.required">角色名称不能为空</span>
								</div>
							</div>
							<label class="col-sm-2 control-label"><i class="red_req">*</i>角色编码：</label>
							<div class="col-sm-3">
								<input type="text" class="form-control"
									ng-model='roleInfo.roleCode' name="roleCode" required>
								<div class="req_mesg" ng-show="horizontalEdit.roleCode.$dirty && horizontalEdit.roleCode.$invalid">
									<span ng-show="horizontalEdit.roleCode.$error.required">角色编码不能为空</span>
								</div>
								<span class="req_mesg" ng-hide="editCodeCheckFlag">
									{{editCodeCheckMsg}}
								</span>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">备注：</label>
							<div class="col-sm-8">
								<input type="text" class="form-control" ng-model='roleInfo.roleRemark'>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label">状态：</label>
							<div class="col-sm-3">
								<switch class="switch" ng-model="roleInfo.roleStatus" ng-true-value="1" ng-false-value="0"/>
							</div>
						</div>
						<div class="form-group">
							<label class="col-sm-2 control-label"></label>
							<div class="col-sm-6">
								<button class="btn btn-primary btn-mr20" type="button" ng-click='submitEditRole()' ng-disabled="horizontalEdit.$invalid || submitting">
									提交</button>
								<button class="btn btn-primary8" type="button" ng-click='cancelEdit()'>取消</button>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<!-- edit role -->
		<div ui-view="modalUser" />
		<div ui-view="modalRight" />
	</form>
</div>